package program01;

/**
 * @version 1.0
 * @since:
 * @ClassName:ArrayPrint
 * @author: Li Jiahui
 * @date: 2021-01-02 19:35
 */
public class ArrayShow extends Array{
    //1.自定义成员变量
    int sumLeftUpToDown = 0;
    int sumRightUpToDown = 0;
    //2.自定义成员方法，用来打印左上角到右下角和右上角到左下角所有元素的累加和并打印。
    void showUpToDown(){

        for (int i = 0; i < 16; i++){
            for (int j = 0; j < 16; j++){
                if(i == j) {
                    sumLeftUpToDown += dyadicArray[i][j];
                }
                if (15 == (i+j)){
                    sumRightUpToDown += dyadicArray[i][j];
                }
            }
        }
        System.out.println("从左上角到右下角累加和：" + sumLeftUpToDown);
        System.out.print("从右上角到左下角累加和：" + sumRightUpToDown);
    }
}
